//
//  WDGoutWaitAssignViewModel.m
//  wd-serviceapp
//
//  Created by Bin Tang on 2024/8/13.
//

#import "WDGoutWaitAssignViewModel.h"

@implementation WDGoutWaitAssignViewModel

- (void)initialize
{
    [super initialize];
    
    self.title = @"工单界面";
    
    _reqModel = [WDTaskSetGrabLockReqModel new];
}

- (void)setupData {
    _reqModel.engineerId = @([EDSAppDelegateTool sharedInstance].userInfoModel.id);
    _reqModel.lockType = @(0);
    _reqModel.taskId = @(self.serviceModel.id);
}

/// 设置抢单锁
/// - Parameter completion: completion description
- (void)requestWithGrabLock:(RequestCompletionBlock)completion {
    @weakify(self);
    WDTaskSetGrabLockRequest *request = [[WDTaskSetGrabLockRequest alloc] initWithModel:self.reqModel];
    [request startWithCompletionBlockWithSuccess:^(__kindof TYZBaseRequest * _Nonnull request) {
        @strongify(self);
        [self sendResponseObject:request.responseModelObject completion:completion];
    } failure:^(__kindof TYZBaseRequest * _Nonnull request) {
        @strongify(self);
        [self sendResponseObject:request.responseModelObject completion:completion];
    }];
}

@end
